home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer 3.1
/
1997-04_Disc_3.1.iso
/
amber
/
amberhub.dxr
/
00036_Field_movieUtils.KILL when done....txt
< prev
next >
Wrap
Text File
|
1996-11-08
|
3KB
|
90 lines
Why use this? Well, it's Mac-only, but it'll allow a few Good Things to happen:
ΓÇó We get the System Folder for placing a Prefs file..
ΓÇó We can determine whether the game is currently being run from the CD or not,
suggesting that the user copy one or more files to the HD (doing it from
within the Projector, and keeping track of what goes where)
ΓÇó Setting the current fileIO path wherever we like, for checking out which files
end up where.. including game assets AND user's saved games
set util = MovieUtilities( mNew ) --creates the object...
put util( mGetVolName, the pathName ) --tells you which volume the Projector is playing from..
-- "xxJumbo:"
put util( mGetSystemPath ) --gives the "blessed" system folder; put Prefs in the "Preferences" folder if
-- "Pluto:System Folder:" -- it exists (see error msg below), or directly in the System folder if it doesn't...
put util( mSetDefaultPath, util( mGetSystemPath ) ) --this sets the default fileIO path to the current system path..
-- 0
put testio = fileIO( mNew, "?read","") --This is standard means of popping up a fileIO dialog box.. confirms that above works!
-- 0
--OK, so this will try to set the path to the "Preferences" folder; if that doesn't
-- exist, it'll fall back to the 'sure thing': the System Folder itself.
if util( mSetDefaultPath, util( mGetSystemPath )&"Preferences:" ) = -43 then ¬
util( mSetDefaultPath, util( mGetSystemPath ) )
--Similarly, when we try to open an existing Prefs file, we should first check the System folder, then the Preferences folder..
-- extract volume name from a given path name string:
on getVolName
global utilObj
if objectP( utilObj ) then
put utilObj( mGetVolName, the pathName ) into field "displayPath"
else
alert "Sorry...no object has been created"
end if
end getVolName
-- returns complete volume and pathName of currently active System folder
-- as a string...useful for creating/opening Prefs:
on getSysPath
global utilObj
if objectP( utilObj ) then
put utilObj( mGetSystemPath ) into field "displayPath"
else
alert "Sorry...no object has been created"
end if
end getSysPath
-- Set the default pathName of "volume:folder(s):" so that
-- with FileIO "?read" permission, the SFGet() Dialog opens to the
-- specified folder. This does not affect the Lingo pathName property.
-- Only tested on System 7.x.
on setPath
global utilObj
if objectP( utilObj ) then
put field "volDirectory" into s
put utilObj( mSetDefaultPath, s ) into result
if result = -35 then
alert "No such volume exists. Please try again..."
else if result = -120 then
alert "Problem in path name. Please try again..."
else if result = -43 then
alert "No such folder exists. Please try again..."
else if result < 0 then
alert "Sorry...system error" && result && ¬
"prevented the folder from being set as the default."
exit
else
put field "volDirectory" into field "displayPath"
end if
else
alert "Sorry...no object has been created"
end if
end setPath